import Vue from "vue";
import VueRouter from "vue-router";
import routes from "@/router/router.js";

Vue.use(VueRouter);

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes
});

//前置导航守卫 路由拦截器 所有路由跳转前都经其处理
//to 将要去的路由
//from 来的路由
//next 只有执行next才能跳转
router.beforeEach(function(to, _from, next) {
  next();
});

router.afterEach(function() {});

export default router;
